<template>
	<view>
		<view class="user">
			<u-avatar size="60" style="flex-shrink: 0;"
				:src="vuex_user && vuex_user.profile ? vuex_user.profile.avatarUrl : '/static/default/avatar.png'"></u-avatar>
			<view class="info">
				<view v-if="vuex_token">
					<view class="nickname">
						{{vuex_user.name||'微信用户'}}</view>
				</view>
				<view v-else class="nickname" @click="navTo('/pages/user/login')">去登录</view>
				<!-- <view class="id">{{userInfo.uuid}}</view> -->
				<view class="sub">{{vuex_user.username}}</view>
			</view>
		</view>
		<view class="p-30">
			<u-cell-group :customStyle="{backgroundColor: 'white', borderRadius: '10px'}" :border="false">
				<u-cell icon="man-add-fill" title="岗位" :border="false" value="村长 书记"></u-cell>
			</u-cell-group>
			<u-cell-group :customStyle="{backgroundColor: 'white', borderRadius: '10px',marginTop:'10px'}" :border="false">
				<u-cell isLink icon="setting-fill" title="个人资料" @click="navTo('/pages/user/profile')"></u-cell>
				<u-cell isLink icon="file-text" title="我的任务" @click="navTo('/pages/user/task/index')"></u-cell>
				<u-cell isLink icon="edit-pen" title="我的提交" @click="navTo('/pages/user/cases/index')"></u-cell>
				<u-cell isLink icon="arrow-leftward" :border="false" title="退出登录" @click="logout"></u-cell>
			</u-cell-group>
		</view>
		<u-popup :show="popupShow" mode="center" @close="popupShow=false" :closeable="true" :round="10"
			:customStyle="{width:'calc(100vw - 30px)'}">
			<view class="agreement_content">
				<scroll-view scroll-y="true" style="height: calc(100vh - 200px);">
					<u-parse :content="kefuCon"></u-parse>
				</scroll-view>
			</view>
		</u-popup>
	</view>
</template>
<script>
	import {
		getPageParam
	} from '@/config/api.js'

	export default {
		data() {
			return {
				popupShow: false,
				kefuCon: ''
			};
		},
		onLoad() {
			console.log(this.vuex_user)
		},
		methods: {
			logout() {
				uni.showModal({
					title: '提示',
					content: '确定要退出登陆吗？',
					success: (res) => {
						if (res.confirm) {
							this.$u.vuex("vuex_token", "");
							this.$u.vuex("vuex_user", {});
							this.$u.vuex("vuex_refresh_token", "");
						} else if (res.cancel) {}
					}
				})
			}
		}
	};
</script>

<style lang="scss">
	page {
		background-color: #f7f7f7;
	}

	.user {
		display: flex;
		align-items: center;
		padding: 30rpx;

		.info {
			padding-left: 20rpx;
			margin-top: 10rpx;

			.sub {
				font-size: 24rpx;
				color: #999999;
				margin-top: 10rpx;

			}
		}

	}

	.vip-box {
		display: flex;

		align-items: center;
		background-image: linear-gradient(to right, #181516, #383838);
		color: #fff;
		border-top-left-radius: 10px;
		border-top-right-radius: 10px;
		padding: 30rpx;

		.left {
			flex-grow: 1;

			.icon {
				display: flex;
				align-items: center;
			}

			.tips {
				coor: #999999;
				font-size: 24rpx;
			}
		}

		.right {
			padding-left: 30rpx;
			flex-shrink: 0;
		}
	}

	.agreement_content {
		padding: 80rpx 30rpx 50rpx 30rpx;
	}
</style>